//
//  EnumSelect.swift
//  Enum实践
//
//  Created by 我演示 on 2020/5/13.
//  Copyright © 2020 Jerry-Fu. All rights reserved.
//


// 基本的用例组合操作


import UIKit
//拥有不同的用力
enum UserAction {
    case OpenUrl(url:NSURL)
    case SwitchProcess(processId: UInt)
    case Restart(time: NSDate? , inteocmmandLine: Bool)
}


enum Selection {
    case None
    case Sinle(Range<Int>)
    case Multiple([Range<Int>])
}

enum Barcode {
    case UPCA(numberSystem: Int , manufactuer:Int , product: Int , check: Int)
    case QRCode(productCode: String)
}

enum KqueueEvent {
    case UserEvent(identifier: UInt, fflags: [UInt32], data: Int)
    case ReadFD(fd: UInt, data: Int)
    case WriteFD(fd: UInt, data: Int)
    case VnodeFD(fd: UInt, fflags: [UInt32], data: Int)
    case ErrorEvent(code: UInt, message: String)
}
// 最后, 一个 RPG 游戏中的所有可穿戴装备可以使用一个枚举来进行映射，
// 可以为一个装备增加重量和持久两个属性
// 现在可以仅用一行代码来增加一个"钻石"属性，如此一来我们便可以增加几件新的镶嵌钻石的可穿戴装备enum
enum Wearable {
    enum Weight: Int {
    case Light = 1
    case Mid = 4
    case Heavy = 10
    }
    enum Armor: Int {
    case Light = 2
    case Strong = 8
    case Heavy = 20
    }
    case Helmet(weight: Weight, armor: Armor)
    case Breastplate(weight: Weight, armor: Armor)
    case Shield(weight: Weight, armor: Armor)
}

let woodenHelmet = Wearable.Helmet(weight: .Light, armor: .Light)
